home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / gamma-bros.swf / scripts / __Packages / classes / misc / Rampage.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  2.6 KB  |  71 lines

  1. class classes.misc.Rampage
  2. {
  3.    var c2Max;
  4.    var colorTrans;
  5.    var l;
  6.    var c = -1;
  7.    var c2 = 0;
  8.    var colorArray = [[255,0,0],[255,125,0],[255,255,0],[255,255,125],[255,255,255],[125,255,125],[0,255,0],[0,255,125],[0,255,255],[255,125,255],[255,0,125]];
  9.    var Name = "rampage";
  10.    function Rampage(max)
  11.    {
  12.       this.c2Max = max;
  13.       this.colorTrans = new flash.geom.ColorTransform();
  14.       _root[_root.char].inv = true;
  15.       this.l = this.colorArray.length;
  16.       var _loc3_ = 0;
  17.       var _loc4_ = _root.randRange(20,30);
  18.       while(_loc3_ < _loc4_)
  19.       {
  20.          _root.fxID = _root.fxID + 1;
  21.          _root["rampageTrail" + _root.fxID] = new classes.fx.RampageTrail(_root[_root.char].x + 20,_root[_root.char].y + 20,_root.fxID);
  22.          _root.addFX("rampageTrail" + _root.fxID);
  23.          _loc3_ = _loc3_ + 1;
  24.       }
  25.       _root.audio.playLevel2("rampageTheme",45);
  26.    }
  27.    function main()
  28.    {
  29.       _root[_root.char].inv = true;
  30.       this.c = this.c + 1;
  31.       this.c2 = this.c2 + 1;
  32.       if(this.c == this.l)
  33.       {
  34.          this.c = 0;
  35.       }
  36.       this.colorTrans.redOffset = this.colorArray[this.c][0];
  37.       this.colorTrans.greenOffset = this.colorArray[this.c][1];
  38.       this.colorTrans.blueOffset = this.colorArray[this.c][2];
  39.       if(this.c2 > this.c2Max - 100)
  40.       {
  41.          var _loc3_ = 100 - (this.c2 - (this.c2Max - 100));
  42.          if(_loc3_ < 90 && _loc3_ > 80 || _loc3_ < 70 && _loc3_ > 60 || _loc3_ < 50 && _loc3_ > 40 || _loc3_ < 30 && _loc3_ > 20 || _loc3_ < 10 && _loc3_ > 0)
  43.          {
  44.             this.colorTrans.redOffset = this.colorArray[this.c][0] * (_loc3_ * 0.01);
  45.             this.colorTrans.greenOffset = this.colorArray[this.c][1] * (_loc3_ * 0.01);
  46.             this.colorTrans.blueOffset = this.colorArray[this.c][2] * (_loc3_ * 0.01);
  47.          }
  48.          else
  49.          {
  50.             this.colorTrans.redOffset = 0;
  51.             this.colorTrans.greenOffset = 0;
  52.             this.colorTrans.blueOffset = 0;
  53.          }
  54.       }
  55.       _root[_root.char].trans.colorTransform = this.colorTrans;
  56.       _root[_root.char].speed = _root[_root.char].baseSpeed + (this.c2Max - this.c) / 100;
  57.       if(random(5 + this.c2 / 10) < 5)
  58.       {
  59.          _root.fxID = _root.fxID + 1;
  60.          _root["rampageTrail" + _root.fxID] = new classes.fx.RampageTrail(_root[_root.char].x + random(40),_root[_root.char].y + random(40),_root.fxID);
  61.          _root.addFX("rampageTrail" + _root.fxID);
  62.       }
  63.       if(this.c2 >= this.c2Max)
  64.       {
  65.          _root[_root.char].speed = _root[_root.char].baseSpeed;
  66.          _root[_root.char].inv = false;
  67.          _root.removePowerUp("rampage");
  68.       }
  69.    }
  70. }
  71.